<template>
	<div class="login" style="background-color: #F2F2F2;text-align:center;width: 100%;height: 100%;">
		<div style="background-color: white;position: absolute;top:50%;width:80%;height:307pt;left: 0; right: 0;margin:0 auto;margin-top:-153pt;">
			<div style="-moz-box-shadow:0px 0px 13px #87A1D6; -webkit-box-shadow:0px 0px 13px #87A1D6; box-shadow:0px 0px 13px #87A1D6;margin: 0 auto;margin-top:-33px;text-align: center;background-color: white;width: 74px;height: 74px;border-radius: 37px;">
				<img style="margin-top: 7px;" src="../../../static/image/login/logo.png" alt="" />
			</div>
			
			<input v-model="username"  size="large" placeholder="请输入账号" style="text-align:center;margin-top: 45px;width: 70%;height:50px;border: 0;border-bottom: 1px solid rgba(240,240,240,1);border-radius: 0px;"></input>
			<input v-model="password"  size="large" type="password"  placeholder="请输入密码" style="text-align:center;width: 70%;height:50px;margin-top: 35px;border: 0;border-bottom: 1px solid rgba(240,240,240,1);border-radius: 0px;"></input>
			<mt-button @click="doLogin" style="background-color: #517EDB;color:white;margin-top:45px;width: 70%;height: 44px;" >登录</mt-button>
			<div style="width: 100%;text-align: center;margin-top: 18px;">
		    	<span style="font-size: 12px;color: #517EDB;">忘记密码?</span>
		    </div>
		</div>
		
		
	</div>
	
</template>

<script>
	import { setsessionstorage } from '@/components/js/Localstorage'
	import api from "@/components/js/Apidomain.js"
	import { Toast } from 'mint-ui';
	export default {
		data() {
			return {
				
				username: "",
				password: "",
			}
		},
		computed: {
			
		},
		methods: {
			doLogin: function() {

				if(this.username == ""){
					Toast({
								message: '账号不能为空',
								position: 'middle',
								duration: 1000
							});
					return; 
				}
				if(this.password == ""){
					Toast({
								message: '密码不能为空',
								position: 'middle',
								duration: 1000
							});
					return;
				} 
				
				this.loadingshow = true;
				var url = api.apidomain+"/tqes/web/login/wxEduMgrCheck"
				var self = this;
				this.$http.post(url, {
						"loginId": this.username,
						"loginPwd":this.password
//						"passWord": md5(this.username + '#' + this.password)
					})
					.then(function(response) {
//						console.log(response.data.data)
						if(response.data.success == true){
							setsessionstorage('authorization',response.data.data.Authorization);
							setsessionstorage('userCode',response.data.data.userCode);
							setsessionstorage('topMenuInfo',JSON.stringify(response.data.data.topMenuInfo));
							setsessionstorage('roleid',response.data.data.sysRole.roleId);
							setsessionstorage('role',response.data.data.sysRole.roleName);
							setsessionstorage('username',response.data.data.userName);
							self.$router.push('/index')
						}else{
							Toast({
								message: response.data.msg,
								position: 'middle',
								duration: 3000
							});
						}
					})
					.catch(function(error) {
						console.log(error);
					});

				
			}
		}
	}
</script>

<style scoped>
	* {
		margin: 0px;
		padding: 0px;
	}
	
	.login >>> input::-webkit-input-placeholder {
         /* placeholder颜色  */
         color: #aab2bd;
         /* placeholder字体大小  */
         font-size: 16px;
         /* placeholder位置  */
         text-align: center;
     }
</style>